﻿<script id="projects_taskListItemTmpl" type="text/x-jquery-tmpl">
    <div class="task with-entity-menu clearFix{{if !$item.data.subtasks.length}} noSubtasks{{/if}}{{if $item.data.canEdit}} canedit{{/if}}{{if $item.data.status == 2}} closed{{/if}}" taskid="${id}">

        {{if ($item.data.canEdit && !Teamlab.profile.isVisitor) || $item.data.canCreateTimeSpend || $item.data.canDelete}}
        <div class="entity-menu"></div>
        {{else}}
        <div class="nomenupoint"></div>
        {{/if}}
        <div class="checkbox">
            <input title="Select" type="checkbox">
        </div>
        <div class="check">
            {{tmpl({canEdit: $item.data.canEdit, status: ASC.Projects.StatusList.getById($item.data.status)}) 'projects_statusChangeContainer'}}
        </div>

        <div class="taskPlace">
            <div class="taskName">
                {{if $item.data.priority == 1}}
                <span class="high_priority"></span>
                {{/if}}
                <a href="tasks.aspx?prjID=${projectOwner.id}&id=${id}" class="linkHeaderMedium{{if $item.data.status == 2}} gray-text{{/if}}">
                    ${title}
                </a>
            </div>
            <div class="subtasksCount">
                {{tmpl 'projects_numSubtasksTmpl'}}
            </div>
        </div>

        {{if $item.data.responsibles.length > 1}}
        <div class="user">
            <span class="other" title="${ASC.Projects.Resources.ProjectResource.TitleTaskResponsibleUsers}">${responsibles.length} ${ASC.Projects.Resources.TasksResource.Responsibles}</span>
        </div>
        {{else}}

        <div class="user">
            {{if $item.data.responsible == null}}
            <span>${ASC.Projects.Resources.TasksResource.NoResponsible}</span>
            {{else}}
            <span {{if responsible.id=='4a515a15-d4d6-4b8e-828e-e0586f18f3a3' || (responsible.isTerminated && !Teamlab.profile.isAdmin)}}class="not-action"{{else}} title="${ASC.Projects.Resources.ProjectResource.TitleTaskResponsibleUser}"{{/if}}>${responsible.displayName}</span>
            {{/if}}
        </div>
        {{/if}}
        {{if $item.data.displayDateDeadline.length}}
        <div class="deadline">
            <span class="timeLeft {{if ASC.Projects.TasksManager.compareDates($item.data.deadline)}}red{{/if}}">${displayDateDeadline}</span>
        </div>
        {{else}}
        {{if $item.data.milestone != null}}
        <div class='deadline'>
            <span class="timeLeft {{if ASC.Projects.TasksManager.compareDates($item.data.milestone.deadline)}}red{{/if}}">${milestone.displayDateDeadline}</span>
            <span class="milestone" title="${ASC.Projects.Resources.TasksResource.Milestone + ': ' + milestone.title}"></span>
        </div>
            {{/if}} 
        {{/if}} 
    </div>
    <div taskid="${id}" class="subtasks"{{if !$item.data.subtasks.length || $item.data.status == 2}} style="display:none;"{{/if}}>
        {{tmpl 'projects_subtasksTemplate'}}
        {{if $item.data.canEdit || $item.data.canCreateSubtask}}
                <div class="quickAddSubTaskLink icon-link plus" {{if ($item.data.status == 1 || $item.data.status == 4) && ($item.data.subtasks.length)}}visible="true"{{else}}visible="false" style="display:none;"{{/if}}> 
                    <span class="link dotline" taskid="${id}">${ASC.Projects.Resources.TasksResource.AddNewSubtask}</span>
                </div>
        {{/if}}
        <div class="st_separater"></div>
        </div> 
</script>

<script id="projects_taskListResponsibles" type="text/x-jquery-tmpl">
    {{each responsibles}}
    {{if $index >= 0}}
    <li userId="${id}" class="user dropdown-item{{if id=='4a515a15-d4d6-4b8e-828e-e0586f18f3a3'}} not-action{{/if}}" title="${displayName}">${displayName}</li>
    {{/if}}
    {{/each}}
</script>

<script id="projects_milestoneForMoveTaskPanelTmpl" type="text/x-jquery-tmpl">
    <div class="ms">
        <input id="ms_${id}" value="${id}" type="radio" name="milestones" {{if checked}} checked="checked" {{/if}}/>
        <label for="ms_${id}">{{if displayDateDeadline}}[${displayDateDeadline}] {{/if}}${title}</label>
    </div>
</script>

<script id="projects_numSubtasksTmpl" type="text/x-jquery-tmpl">
    {{if ASC.Projects.TasksManager.openedCount($item.data.subtasks)}}
    <span class="collaps link dotline" title="${ASC.Projects.Resources.ProjectResource.TitleTaskOpenSubtasks}" taskid="${id}">+{{html ASC.Projects.TasksManager.openedCount($item.data.subtasks)}}</span>
    {{else}}
    {{if $item.data.canCreateSubtask}}
    <span class="add">+ ${ASC.Projects.Resources.TasksResource.Subtask}</span>
    {{/if}}
    {{/if}}
</script>
<script id="projects_taskActionUser" type="text/x-jquery-tmpl">
    {{each $data}}
    <div data-value="${$value.id}" class="user">${$value.title}</div>
    {{/each}}
</script>